package com.fr.report.web.ui;

import com.fr.base.core.ComparatorUtils;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.report.io.xml.ReportXMLUtils;

public class UserDefinedWidgetConfig extends AbstractWidgetConfig
{
  public static final String XML_TAG = "UWC";
  private Widget widget;

  public UserDefinedWidgetConfig()
  {
    setWidget(new TextEditor());
  }

  public Widget getWidget()
  {
    return this.widget;
  }

  public void setWidget(Widget paramWidget)
  {
    this.widget = paramWidget;
  }

  public Widget toWidget()
  {
    return this.widget;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if ((paramXMLableReader.isChildNode()) && ("Widget".equals(paramXMLableReader.getTagName())))
      this.widget = ReportXMLUtils.readWidget(paramXMLableReader);
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    if (this.widget != null)
      ReportXMLUtils.writeXMLable(paramXMLPrintWriter, this.widget, "Widget");
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof UserDefinedWidgetConfig))
      return false;
    return ComparatorUtils.equals(((UserDefinedWidgetConfig)paramObject).widget, this.widget);
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    UserDefinedWidgetConfig localUserDefinedWidgetConfig = (UserDefinedWidgetConfig)super.clone();
    if (this.widget != null)
      localUserDefinedWidgetConfig.widget = ((Widget)this.widget.clone());
    return localUserDefinedWidgetConfig;
  }
}